// 公司热招职位的组件
import { Link } from "react-router-dom";
import { IRecruit } from "../../types";
import style from "./style.module.css";
import * as Enum from "../../assets/enum";

interface Props {
  rows: IRecruit;
}

export default function CompanyRecruitItem(props: Props) {
  return (
    <ul className={style.positionItem}>
      <li>
        <Link
          to={"/recruit/" + props.rows._id}
          className={style.alink}
          onClick={() => {
            window.scrollTo(0, 0);
          }}
        >
          <h4>
            <span className={style.price}>
              {props.rows?.salary.min}-{props.rows?.salary.max}k
            </span>
            {props.rows?.positionName}
          </h4>
          <div>
            {props.rows?.city} <i className={style.vline}></i>
            {Enum.toYear(props.rows?.workYear)}
            <i className={style.vline}></i>
            {Enum.toEducation(props.rows?.education)}
          </div>
          <div className={style.boss}>
            <img
              src={`/api/user/download/${props.rows.users[0]._id}`}
              alt="头像"
            />
            <span>
              {props.rows.users[0]?.name} · {props.rows.users[0]?.positionName}
            </span>
            <button className={style.btn}>立即沟通</button>
          </div>
        </Link>
      </li>
    </ul>
  );
}
